/**********************************************************************************************
     * Class Name: NMRSLRProcessingTest 
     * Author: Accenture 
     * Date: 14-March-2012  
     * Requirement/Project Name: NMR 
     * Requirement Description: Test class to validate classes NMRSLRProcessing and NMRMasterLeadEnrichment,
                                and for the trigger NMRSLRProcessingTrig
                        
***********************************************************************************************/

@isTest

private class NMRSLRProcessingTest{

 static testMethod void SLRStandardization(){
    
    test.startTest();
    
    ID slrRecordTypeID = RecordTypeHelper.GetRecordTypeID('Standardized_Lead_Request__c', 'Standardized Lead Request');
    ID mdmRecordTypeID = RecordTypeHelper.GetRecordTypeID('MDM_Listing_Matches__c', 'MDM Customer Matches');
    ID cwsRecordTypeID = RecordTypeHelper.GetRecordTypeID('CWS_Account_Matches__c', 'CWS Customer Matches');
    
    List<Standardized_Lead_Request__c> slrList = new List<Standardized_Lead_Request__c>();
    
    Standardized_Lead_Request__c SLR = new Standardized_Lead_Request__c(Company__c = '', 
    Business_Name__c = 'ACC', Business_Phone__c = '5000000005', Lead_Source__c = 'AdStore', Lead_Type__c = 'Listing', Status__c = 'New', Contact_Email__c = 'jdoe@starbucks.com', 
    Addl_Email_Addresses__c = 'jdoe@gmail.com;jdoe@yahoo.com', Additional_Phone_Number_1__c = '5000000000',  
    Additional_Phone_Number_2__c = '5000000001', Additional_Phone_Number_3__c = '5000000002', Additional_Phone_Number_4__c = '5000000003',
    Additional_Phone_Number_5__c = '5000000004', Advertiser_Comments__c = 'Test', Campaign_Medium__c = 'Internet', Campaign_Source__c = 'Self', Campaign_Name__c = 'IN1',
    Campaign_Content__c = 'Test', Campaign_Term__c = '4 Wks', Campaign_Category__c = 'test', Offer_Type__c = 'Test', Business_Website_URL__c = 'http://www.starbucks.com',
    Contact_Last_Name__c = 'Doe', Contact_First_Name__c = 'John', Sales_Channel__c = 'Nice', LMC_Listing_Id__c = 'Okay', ASCP_Account_Created_Date__c = System.now(),
    Address_Line__c = '12th Lane', City__c = 'AL', State__c = 'GE', Zip__c = '37686', General_Description__c = 'Coffeee',In_Business_Since__c='1986', Business_Description__c = 'Lots of Coffee. Less prices',
    Chain_ID__c = '123456', Lead_Source_Friendly_Name__c = 'Bucks', ECommerce_CID__c = '1234ABC', Source_Lead_Id__c = '1234', RecordTypeId = slrRecordTypeID);
    slrList.add(SLR);
    insert SLR;
      
    Original_Lead_Request__c OLR = new Original_Lead_Request__c(Company__c = 'Starbucks', 
    Business_Phone__c = '7837473364', Lead_Source__c = 'AdStore', Status__c = 'New', Standardized_Lead_Request__c = SLR.id);
    
    insert OLR;
    
    MDM_Listing_Matches__c MDM = new MDM_Listing_Matches__c(Contact_Email__c = 'jdoe@starbucks.com', 
    Is_Matched__c = true, Phone__c = '5000000004', Addl_Email_Addresses__c = 'jdoe@yahoo.com;jdoe@hotmail.com', YP_Id__c ='6657b55',
    Number_of_Employees__c = '1 - 100', Customer_Id__c = '77865432b', Pay_Free_Flag__c = 'Pay', Ad_Spending__c = 'Low',
    Ad_Size__c = 'Small', Hours__c = '7 AM to 7 PM', General_Description__c = 'Lots of coffee', URL__c = 
    'Twitter:@starbucks; Facebook:Starbucks;', Chain_ID__c = '123455', AKAs__c = 'The Starbucks', In_Business_Since__c
    = '1990', Service_Products__c = 'Coffee', Street_Address__c = '150th Lane', City__c = 'LA', State__c = 'CA', Zip__c
    ='97686', Standardized_Lead_Request__c = SLR.id, RecordTypeId = mdmRecordTypeID, Business_Website_URL__c = 'www.starbucks.com',
    Business_Description__c = 'Coffee', Source__c = 'Test');
    
    insert MDM;
    
    CWS_Account_Matches__c CWS = new CWS_Account_Matches__c(Customer_Name__c = 'STARBUCKS', Customer_Id__c = '557493003',
    Assigned_Rep_ATTUID__c = 'ab123c', Is_Matched__c = true, Standardized_Lead_Request__c = SLR.id,  RecordTypeId = cwsRecordTypeID);
    
    insert CWS;
    
    List<Cate__c> headings = new Cate__c[4];
    headings.set(0, new Cate__c(Heading_Code__c = 1000, Description__c = 'Coffee Coffee Coffee Coffee Coffee Coffee Coffee Coffee', Original_Lead_Request__c = OLR.Id));
    headings.set(1, new Cate__c(Heading_Code__c = 1001, Description__c = 'Tea', Original_Lead_Request__c = OLR.Id));
    headings.set(2, new Cate__c(Heading_Code__c = 1000, Description__c = 'Coffee', MDM_Listing_Matches__c = MDM.Id));
    headings.set(3, new Cate__c(Heading_Code__c = 1002, Description__c = 'Espresso', MDM_Listing_Matches__c = MDM.Id));
    //headings.set(4, new Cate__c(Heading_Code__c = 1002, Description__c = 'Espresso', Standardized_Lead_Request__c = secondSLR.Id));
    
    insert headings;
    
    List<Do_Not_Call__c> DNCList = new List<Do_Not_Call__c>();
    for(Integer i = 0; i < 6; i++){
        Do_Not_Call__c DNC = new Do_Not_Call__c(Phone_Number__c = '(500) 000-000' + i, Active__c = true);
        DNCList.add(DNC);
    }

    insert DNCList;
    
    
    SLR.Status__c = 'SIL Process Completed';
    
    
    update SLR;
   
    
    Standardized_Lead_Request__c secondSLR = new Standardized_Lead_Request__c(Company__c = 'Starbucks', 
    Business_Phone__c = '5000000005', Lead_Source__c = 'AdStore', Lead_Type__c = 'Inquiry', Offer_Product__c = 'Test',
    Offer_Flow_Progress__c = 'TestFlow', Status__c = 'New', RecordTypeId = slrRecordTypeID);

    
    insert secondSLR ;
    secondSLR.Status__c = 'SIL Process Completed';
    update secondSLR;
    
    test.stopTest();
}


}